package day5;

import java.util.Arrays;

/**
 * ClassName：TestString
 *
 * @Author：小鱼
 * @Create：2025-08-08 9:06
 */
public class TestString {
    public static void main(String[] args) {
        String s1 = "123";
        String s2 = new String("123");
        System.out.println(s1.length());
        System.out.println(s2.length());

        String s11 = "Abc";
        String s12  =new String("abc");
        String s13 = "abc";
        System.out.println(s11.equals(s12));
        System.out.println(s11.equals(s13));

        System.out.println(s1.charAt(0));
        //System.out.println(s1.charAt(3));
        //System.out.println(s1.charAt(-5));
        String s21 = "你好";
        System.out.println(s21.charAt(0));


//        char[] c = s11.toCharArray();
//        System.out.println(Arrays.toString(c));

//        String ns11 = s11.substring(1);
//        System.out.println(s11);
//        System.out.println(ns11);
        String ns11 = s11.substring(1,2);
        System.out.println(s11);
        System.out.println(ns11);


        String newS1 = s11.replace('A', '5');
        System.out.println(newS1);
        String newS2 = s11.replace("A", "6");
        System.out.println(newS2);
        String newS3 = s11.replace("d", "6");
        System.out.println(newS3);


        System.out.println(s11.indexOf("b"));

    }
}
